package org.rcgwt.client.ui.validator.impl;

import java.util.Map;

import org.rcgwt.client.ui.validator.ICharacterSets;
import org.rcgwt.client.ui.validator.IClientValidatorContext;
import org.rcgwt.client.ui.validator.IFilter;

/**
 * A Filter which filters a money character (like digits, dot, comma, minus,
 * plus and currency characters)
 * 
 * @author Elian ORIOU
 * 
 */

public class MoneyFilter implements IFilter {
	private static final String MY_PATTERN = ICharacterSets.NUM_SET
			+ ICharacterSets.CURRENCY_SET;

	public MoneyFilter(Map<String, String> parameters) {

	}

	@Override
	public boolean filter(IClientValidatorContext context, char c) {
		if (MY_PATTERN.indexOf(c) != -1 || c == '.' || c == ',' || c == '-'
				|| c == '+') {
			return true;
		}
		return false;
	}
}
